<?php
// +----------------------------------------------------------------------
// | wttai [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.wttai.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: 老司机 <wutongtai@wttai.com> <http://www.wttai.com>
// +----------------------------------------------------------------------
namespace Home\Controller;

/**
 * 文档模型控制器
 * 文档模型列表和详情
 */
class CategoryController extends HomeController
{

    public function index($p = 1)
    {
        
        $category=D('Category');
        //获取当前站点下面的所有文章
        $categoryAll = $category->getTree(1);//获取分类
        $categoryAll=$categoryAll['_'];
        $cate_count=count($categoryAll);
        $page = ceil($cate_count/100)+1;
        
        if ($p >= $page){
            redirect('/');
        }
        if ($cate_count > 0) {
            //$list = D('Document')->alias('a')->field('a.*')->page($p, $list_row)->join('__ARTICLE_CATEGORY__ AS `b` on a.`id` = b.`article_id`')->where($map)->select();
            $this->_page($cate_count, $list_row, '/tags'.$p.'.html');
        }
        $this->header();//头部内容
        $this->assign('category',$categoryAll);
        $this->assign('page',$page);//分页s
        $this->assign('p',$p);//当前页
        $this->display('category');
    }
}
